using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace WIT.DAQ.Core.Forms;

/// <summary>
/// 删除日志窗口
/// </summary>
internal class DelLogForm : BaseForm
{
	/// <summary>
	/// Required designer variable.
	/// </summary>
	private IContainer components = null;

	private DateTimePicker dtpTime;

	private Label label1;

	private Label label2;

	private Button btnConfirm;

	private Button btnCancel;

	/// <summary>
	/// 删除日志窗口
	/// </summary>
	internal DelLogForm()
	{
		InitializeComponent();
	}

	private void DelLogForm_Load(object sender, EventArgs e)
	{
		dtpTime.Value = Convert.ToDateTime(DateTime.Now.AddDays(-7.0).ToString("yyyy/MM/dd 00:00:00"));
	}

	private void btnConfirm_Click(object sender, EventArgs e)
	{
		Common.ShrinkLogDB(dtpTime.Value);
		MessageBox.Show("操作成功");
		Close();
	}

	private void btnCancel_Click(object sender, EventArgs e)
	{
		Close();
	}

	/// <summary>
	/// Clean up any resources being used.
	/// </summary>
	/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
	protected override void Dispose(bool disposing)
	{
		if (disposing && components != null)
		{
			components.Dispose();
		}
		base.Dispose(disposing);
	}

	/// <summary>
	/// Required method for Designer support - do not modify
	/// the contents of this method with the code editor.
	/// </summary>
	private void InitializeComponent()
	{
		this.dtpTime = new System.Windows.Forms.DateTimePicker();
		this.label1 = new System.Windows.Forms.Label();
		this.label2 = new System.Windows.Forms.Label();
		this.btnConfirm = new System.Windows.Forms.Button();
		this.btnCancel = new System.Windows.Forms.Button();
		base.SuspendLayout();
		this.dtpTime.CustomFormat = "yyyy/MM/dd HH:mm:ss";
		this.dtpTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
		this.dtpTime.Location = new System.Drawing.Point(71, 40);
		this.dtpTime.Name = "dtpTime";
		this.dtpTime.Size = new System.Drawing.Size(153, 21);
		this.dtpTime.TabIndex = 0;
		this.dtpTime.Value = new System.DateTime(1991, 1, 1, 0, 0, 0, 0);
		this.label1.AutoSize = true;
		this.label1.Location = new System.Drawing.Point(36, 46);
		this.label1.Name = "label1";
		this.label1.Size = new System.Drawing.Size(29, 12);
		this.label1.TabIndex = 11;
		this.label1.Text = "删除";
		this.label2.AutoSize = true;
		this.label2.Location = new System.Drawing.Point(230, 46);
		this.label2.Name = "label2";
		this.label2.Size = new System.Drawing.Size(65, 12);
		this.label2.TabIndex = 12;
		this.label2.Text = "之前的日志";
		this.btnConfirm.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
		this.btnConfirm.Location = new System.Drawing.Point(166, 106);
		this.btnConfirm.Name = "btnConfirm";
		this.btnConfirm.Size = new System.Drawing.Size(75, 23);
		this.btnConfirm.TabIndex = 1;
		this.btnConfirm.Text = "确认(&S)";
		this.btnConfirm.UseVisualStyleBackColor = true;
		this.btnConfirm.Click += new System.EventHandler(btnConfirm_Click);
		this.btnCancel.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
		this.btnCancel.Location = new System.Drawing.Point(247, 106);
		this.btnCancel.Name = "btnCancel";
		this.btnCancel.Size = new System.Drawing.Size(75, 23);
		this.btnCancel.TabIndex = 2;
		this.btnCancel.Text = "取消(&C)";
		this.btnCancel.UseVisualStyleBackColor = true;
		this.btnCancel.Click += new System.EventHandler(btnCancel_Click);
		base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.ClientSize = new System.Drawing.Size(334, 141);
		base.Controls.Add(this.btnConfirm);
		base.Controls.Add(this.btnCancel);
		base.Controls.Add(this.label2);
		base.Controls.Add(this.label1);
		base.Controls.Add(this.dtpTime);
		base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
		base.MaximizeBox = false;
		base.Name = "DelLogForm";
		this.Text = "删除日志";
		base.Load += new System.EventHandler(DelLogForm_Load);
		base.ResumeLayout(false);
		base.PerformLayout();
	}
}
